﻿using System;

namespace MediaAssistant.DAL.Constants
{
    public class LibraryItemType
    {
        public const string RecentlyAddedMovieLibrary = "RecentlyAddedMovieLibrary";
        public const string IMDbMustWatchList = "IMDbMustWatchList";
        public const string WishListLibrary = "WishListLibrary";
        public const string FailedLibrary = "FailedLibrary";
        public const string StaredMovieLibrary = "StaredMovieLibrary";
        public const string RecommendedMovieLibrary = "RecommendedMovieLibrary";
        public const string UnreadMovieLibrary = "UnreadMovieLibrary";
        public const string RecentlyPlayedMovieLibrary = "RecentlyPlayedMovieLibrary";
        public const string ProcessingLibrary = "ProcessingLibrary";
        public const string Year="Year";
        public const string Rated="Rated";
        public const string Actor="Actor";
        public const string Writer="Writer";
        public const string Director = "Director";
        public const string MovieGenre="Movie Genre";
        public const string RatedLibrary="RatedLibrary";
        public const string WatchListLibrary = "WatchListLibrary";
        public const string YearLibrary = "YearLibrary";
        public const string MovieGenreLibrary = "MovieGenreLibrary";
        public const string WriterLibrary = "WriterLibrary";
        public const string ActorLibrary = "ActorLibrary";
        public const string DirectorLibrary = "DirectorLibrary";
        public const string MovieLibrary = "MovieLibrary";
        public const string NowPlayingPlaylist = "Now Playing";
        public const string LastImportedPlaylist = "Last Imported Music";
        public const string Playlist = "Playlist";
        public const string Genre="Genre";
        public const string Album="Album";
        public const string Artist="Artist";
        public const string GenreLibrary = "GenreLibrary";
        public const string AlbumLibrary = "AlbumLibrary";
        public const string ArtistLibrary = "ArtistLibrary";
        public const string MusicLibrary = "MusicLibrary";
        public const string PlayListLibrary = "PlayListLibrary";
        public const string ComposerLibrary = "ComposerLibrary";
        public const string Composer = "Composer";
        public const int RootItemsCount = 3;
        public static bool IsRootItem(string type)
        {
            switch (type)
            {
                case MovieLibrary:
                case MusicLibrary:
                case PlayListLibrary:
                    return true;
            }
            return false;
        }
        public static bool IsMovieLeaf(string  type)
        {
            switch (type)
            {
                case Actor:
                case Director:
                case Writer:
                case Rated:
                case Year:
                case MovieGenre:
                    return true;
            }
            return false;
        }

        /// <exception cref="Exception">Parent Type not found</exception>
        public static string GetParentType(string type)
        {
            switch (type)
            {
                case Album:
                    return AlbumLibrary;
                case Artist:
                    return ArtistLibrary;
                case Genre:
                    return GenreLibrary;
                case Playlist:
                    return PlayListLibrary;
                case Composer:
                    return ComposerLibrary;

                case AlbumLibrary:
                case ArtistLibrary:
                case GenreLibrary:
                case ComposerLibrary:
                    return MusicLibrary;

                case DirectorLibrary:
                case ActorLibrary:
                case WriterLibrary:
                case MovieGenreLibrary:
                case RatedLibrary:
                case YearLibrary:
                case WatchListLibrary:
                case ProcessingLibrary:
                case FailedLibrary:
                case UnreadMovieLibrary:
                case StaredMovieLibrary:
                case RecommendedMovieLibrary:
                case WishListLibrary:
                case IMDbMustWatchList:
                case RecentlyPlayedMovieLibrary:
                case RecentlyAddedMovieLibrary:
                    return MovieLibrary;
                case MovieGenre:
                    return MovieGenreLibrary;
                case Director:
                    return DirectorLibrary;
                case Writer:
                    return WriterLibrary;
                case Actor:
                    return ActorLibrary;
                case Rated:
                    return RatedLibrary;
                case Year:
                    return YearLibrary;
            }
            return String.Empty;
        }

        public static bool IsMusicItem(string type)
        {
            switch (type)
            {
                case Album:
                case Artist:
                case Genre:
                case Playlist:
                case Composer:
                case AlbumLibrary:
                case ArtistLibrary:
                case GenreLibrary:
                case ComposerLibrary:
                case MusicLibrary:
                case PlayListLibrary:
                    return true;
            }
            return false;
        }

        public static bool IsMovieItem(string type)
        {
            switch (type)
            {
                case UnreadMovieLibrary:
                case DirectorLibrary:
                case ActorLibrary:
                case WriterLibrary:
                case MovieGenreLibrary:
                case YearLibrary:
                case RatedLibrary:
                case WatchListLibrary:
                case ProcessingLibrary:
                case FailedLibrary:
                case StaredMovieLibrary:
                case RecommendedMovieLibrary:
                case WishListLibrary:
                case MovieLibrary:
                case MovieGenre:
                case Director:
                case Writer:
                case Actor:
                case Rated:
                case Year:
                case IMDbMustWatchList:
                case RecentlyPlayedMovieLibrary:
                case  RecentlyAddedMovieLibrary:
                    return true;
            }
            return false;
        }

        public const string MusicType = "Music";
        public const string MovieType = "Movie";

        public static bool CanHaveChildren(string type)
        {
            switch (type)
            {
                case MovieLibrary:
                case DirectorLibrary:
                case ActorLibrary:
                case WriterLibrary:
                case MovieGenreLibrary:
                case YearLibrary:
                case RatedLibrary:

                case MusicLibrary:
                case AlbumLibrary:
                case ArtistLibrary:
                case GenreLibrary:
                case ComposerLibrary:
                case PlayListLibrary:
                    return true;
                default:
                    return false;
            }
        }

        public static bool IsLastParent(string type)
        {
            switch (type)
            {
                case DirectorLibrary:
                case ActorLibrary:
                case WriterLibrary:
                case MovieGenreLibrary:
                case YearLibrary:
                case RatedLibrary:

                case AlbumLibrary:
                case ArtistLibrary:
                case GenreLibrary:
                case ComposerLibrary:
                case PlayListLibrary:
                    return true;
                default:
                    return false;
            }
        }
    }
}